import QtQuick 2.0

Item {
    id: container
    property string title
    property string note

    property bool isPinned: false
    property int titleOffset: 10

    width:  300
    height: notesContainer.height + 90

    Rectangle {
        id: borders
        anchors.fill: parent
        gradient: Gradient {
            GradientStop { position: 0.0; color: "#FCF0AD" }
            GradientStop { position: 1.0; color: "#ffe036" }
        }

        border.color: "black"
        border.width: 1
        radius: 10

        Column {
            width: parent.width
            spacing: 30
            Text {
                id: titleText
                text: title
                font.family: "Helvetica"
                font.pointSize: 30
                color: "Black"
                anchors.horizontalCenter: parent.horizontalCenter
            }

            Column {
                id: notesContainer
                width: parent.width
                spacing: 10

            }
        }
    }

    NoteMenu {
        id: menu
    }


    Rectangle {
        width: 40
        height: 20
        color: sidemenu.unselectColor

        border.width: 1
        border.color: content.border.color
        anchors.bottom: container.bottom
        anchors.right: container.right
        anchors.rightMargin: 10
        anchors.bottomMargin: 10

        Text {
            anchors.fill: parent
            text: "Add"
            font.family: "Verdana"
            font.pointSize: 10
            verticalAlignment: Text.AlignVCenter
            horizontalAlignment: Text.AlignHCenter
            color: "white"
        }

        MouseArea {
            anchors.fill: parent

            onClicked: {
                myKit.selectedTODO = container;
                startSpeechRecognitionReq("todoItem", 4000);
            }
        }
    }

    MouseArea {
        anchors.fill: parent
        drag.target: parent
        propagateComposedEvents: true
    }

    function addItem(todoText) {
       var component = Qt.createComponent("TODOItem.qml");
       var todo = component.createObject(notesContainer, {"note": todoText});
    }
}
